/* SPDX-License-Identifier: GPL-2.0-or-later */

/* normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css
 * IE support removed. */

/* stylelint-disable plugin/no-unsupported-browser-features */
html {
	height: 100%;
	line-height: 1.15;
	-webkit-text-size-adjust: 100%;
}

h1 {
	margin: 0.67em 0;
	font-weight: normal;
	font-size: 2em;
}

hr {
	box-sizing: content-box;
	height: 0;
	overflow: visible;
}

pre {
	font-size: 1em;
	font-family: monospace;
}

abbr[title] {
	text-decoration: underline;
	text-decoration: underline dotted;
	border-bottom: none;
}

b,
strong {
	font-weight: bolder;
}

code,
kbd,
samp {
	font-size: 1em;
	font-family: monospace;
}

small {
	font-size: 80%;
}

sub,
sup {
	position: relative;
	font-size: 75%;
	line-height: 0;
	vertical-align: baseline;
}

sub {
	bottom: -0.25em;
}

sup {
	top: -0.5em;
}

button,
input,
optgroup,
select,
textarea {
	margin: 0;
	font-size: 100%;
	font-family: inherit;
	line-height: 1.15;
}

button,
input {
	overflow: visible;
}

button,
select {
	text-transform: none;
}

button,
[type="button"],
[type="reset"],
[type="submit"] {
	-webkit-appearance: button;
}

button {
	padding: 0;
	border: 0;
	outline: none;
}

button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
	padding: 0;
	border-style: none;
}

button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
	outline: 1px dotted ButtonText;
}

fieldset {
	padding: 0.35em 0.75em 0.625em;
}

legend {
	display: table;
	box-sizing: border-box;
	max-width: 100%;
	padding: 0;
	color: inherit;
	white-space: normal;
}

textarea {
	overflow: auto;
}

[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
	height: auto;
}

[type="search"] {
	outline-offset: -2px;
	-webkit-appearance: textfield;
}

[type="search"]::-webkit-search-decoration {
	-webkit-appearance: none;
}

::-webkit-file-upload-button {
	font: inherit;
	-webkit-appearance: button;
}

details {
	display: block;
}

summary {
	display: list-item;
}

/* normalize.css end */

progress[value] {
	vertical-align: baseline;
	border: none;
	border-radius: 0;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
}

progress[value]::-webkit-progress-bar {
	background-color: #eee;
	box-shadow: 0 2px 5px rgb(0 0 0 / 25%) inset;
}

progress[value]::-webkit-progress-value {
	background: var(--color3);
}

progress[value]::-moz-progress-bar {
	background: var(--color3);
}

/* stylelint-enable  plugin/no-unsupported-browser-features */

:root {
	font-size: 12vw; /* Window scale */
	font-family: Arial, Helvetica, sans-serif;

	--barsize: 1.4rem;
	--icon-padding: 0.15rem;
	--sidebar-width: 6rem;
	--topbar-height: 1.4rem;
	--size-minus-topbar: calc(100% - var(--topbar-height));
	--gridsize: 1;
}

body {
	display: flex;
	height: 100%;
	margin: 0;
	background-color: var(--colorbg);
}

ul {
	margin: 0;
	padding: 0;
}

li,
span {
	display: block;
}

input {
	display: block;
	padding: 0;
}

a:focus {
	outline: none;
}

img {
	pointer-events: none;
}

/* Mobile portrait mode */

/* sidebar */
#topbar {
	position: absolute;
	z-index: 1;
	display: flex;
	width: 100%;
	background: var(--color1);
}

.topbar-btn {
	display: flex;
	flex-shrink: 0;
	justify-content: center;
	align-items: center;
	width: var(--topbar-height);
	height: var(--topbar-height);
}

#current-page {
	margin: auto;
	color: var(--color-text);
	font-size: 0.7rem;
}

#topbar-options-btn {
	margin-top: auto;
	visibility: hidden;
}

#topbar-options-btn img {
	aspect-ratio: 1;
	height: 0.9rem;
}

#options-checkbox {
	position: absolute;
	visibility: hidden;
}

#options-btn {
	position: absolute;
	right: 0;
	z-index: 2;
	width: var(--topbar-height);
	height: var(--topbar-height);
}

#options-menu {
	position: absolute;
	top: var(--topbar-height);
	right: 0;
	z-index: 3;
	display: flex;
	flex-direction: column;
	visibility: hidden;

	--options-menu-btn-width: 1.2rem;
}

.options-menu-btn {
	display: flex;
	justify-content: center;
	align-items: center;
	width: var(--options-menu-btn-width);
	height: var(--options-menu-btn-width);
	color: var(--color-text);
	font-size: 0.5rem;
	background: var(--color2);
}

.options-menu-btn:hover {
	background: var(--color3);
}

.options-menu-btn img {
	aspect-ratio: 1;
	height: 0.8rem;
	margin: 0.2rem;
	font-size: 0;
}

#options-checkbox:checked ~ #options-menu {
	visibility: visible;
}

.options-popup {
	position: absolute;
	right: var(--options-menu-btn-width);
	display: none;
	flex-direction: column;
	max-height: 100vh;
	margin: auto;
	background: var(--color2);
}

.options-popup-open {
	display: flex;
}

.options-popup-content {
	overflow-y: auto;
}

/* Date picker. */
.date-picker {
	padding: 0.2rem;
}

.date-picker-month {
	display: flex;
	align-items: center;
	font-size: 0;
	border-color: var(--color3-hover);
	border-bottom-style: solid;
}

.date-picker-month-btn {
	background: var(--color2);
}

.date-picker-month-btn img {
	aspect-ratio: 1;
	height: 0.9rem;
}

.date-picker-month-label {
	width: 100%;
	color: var(--color-text);
	font-size: 0.52rem;
	text-align: center;
}

.date-picker-calendar {
	display: grid;
	grid-template-columns: repeat(7, auto);
	font-size: 0.6rem;
}

.date-picker-day-btn {
	height: 0.85rem;
	padding: 0.05rem;
	color: var(--color-text);
	background: var(--color3);
	border-width: 0.05rem;
	border-style: solid;
	border-color: var(--color2);
	border-radius: 0.15rem;
}

.date-picker-day-btn:hover {
	background: var(--color3-hover);
}

.date-picker-day-selected {
	background: var(--color-red-hover);
}

.date-picker-day-selected:hover {
	background: var(--color-red-hover);
}

.date-picker-hour-buttons {
	display: flex;
	flex-direction: column;
	justify-content: center;
	margin-right: 0.1rem;
	margin-left: 0.1rem;
}

.date-picker-hour {
	display: flex;
	justify-content: center;
	margin-top: 0.05rem;
	margin-bottom: 0.05rem;
}

.date-picker-hour-btn {
	font-size: 0;
	background: var(--color3);
}

.date-picker-hour-btn:hover {
	background: var(--color3-hover);
}

.date-picker-hour-btn img {
	width: 0.6rem;
	height: 0.5rem;
	font-size: 0;
}

.date-picker-hour-input {
	width: 0.9rem;
	height: 0.8rem;
	font-size: 0.7rem;
	-moz-appearance: textfield;
}

.date-picker-hour-input::-webkit-inner-spin-button,
.date-picker-hour-input::-webkit-outer-spin-button {
	-webkit-appearance: none;
}

.date-picker-hour-label {
	color: var(--color-text);
	font-size: 1rem;
}

.date-picker-hour-middle {
	display: flex;
	align-items: center;
}

.date-picker-bottom {
	display: flex;
	justify-content: space-around;
}

.date-picker-bottom-btn {
	padding: 0.1rem;
	color: var(--color-text);
	font-size: 0.6rem;
	background: var(--color3);
	border-radius: 0.15rem;
}

.date-picker-bottom-btn:hover {
	background: var(--color3-hover);
}

.date-picker-apply {
	background: var(--color-green);
}

.date-picker-apply:hover {
	background: var(--color-green-hover);
}

/* Select one. */
.select-one {
	display: flex;
	flex-direction: column;
	color: var(--color-text);
	text-align: center;
}

.select-one-label {
	padding: 0.1rem;
	font-size: 0.8rem;
}

.select-one-item {
	display: block ruby;
	padding: 0.1rem 0.2rem;
	font-size: 0.7rem;
	background: var(--color3);
	border-top: solid;
	border-top-width: 0.01rem;
	border-top-color: var(--color2);
}

.select-one-item:hover {
	background: var(--color3-hover);
}

.select-one-item-selected {
	background: var(--color2);
}

/* Sidebar. */

#sidebar {
	position: absolute;
	z-index: 5;
	display: flex;
	flex-direction: column;
	width: var(--sidebar-width);
	height: 100%;
	overflow-x: hidden;
	background: var(--color1);
	transform: translateX(-100%);
	transition: transform 400ms;
}

#sidebar-checkbox {
	position: absolute;
	display: none;
}

#sidebar-btn {
	position: absolute;
	z-index: 10;
	width: var(--barsize);
	height: var(--barsize);
}

#sidebar-closer {
	position: absolute;
	z-index: 4;
	display: none;
	width: 100vw;
	height: 100vh;
}

#nav-btn {
	padding-left: 0.2rem;
	border: none;
}

#sidebar-checkbox:checked ~ #sidebar {
	transform: none;
}

#sidebar-checkbox:checked ~ #sidebar-closer {
	display: block;
}

#sidebar-checkbox:checked ~ #sidebar-btn {
	width: var(--sidebar-width);
}

#sidebar-btn:hover ~ * #topbar-btn {
	background: var(--color1-hover);
}

#sidebar-btn:hover ~ * #nav-btn {
	background: var(--color1-hover);
}

#navbar {
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow-x: hidden;
}

.icon {
	height: 1.1rem;
	aspect-ratio: 1;
	filter: var(--color-icons);
}

.nav-link {
	display: flex;
	align-items: center;
	width: var(--sidebar-width);
	padding: var(--icon-padding);
	padding-left: 0.3rem;
	text-decoration: none;
	border-width: 0.01rem;
	border-color: var(--color1-hover);
	border-bottom-style: solid;
}

.nav-link:focus {
	background: var(--color1-hover);
}

.nav-link:hover {
	background: var(--color1-hover);
}

.nav-text {
	margin-left: 0.4rem;
	color: var(--color-text);
	font-size: 0.6rem;
}

/* Content */
#content {
	position: absolute;
	box-sizing: border-box;
	width: 100%;
	height: 100%;
	padding-top: var(--barsize);
}

/* needed for scrolling on overflow */
#content-grid-wrapper {
	height: 100%;
	overflow-y: auto;
}

#content-grid {
	display: grid;
	grid-template-columns: repeat(var(--gridsize), auto);
}

.grid-fullscreen {
	display: flex;
	position: absolute;
	z-index: 100;
	width: 100vw;
	height: 100vh;
	top: 0;
	left: 0;
	background: var(--colorbg);
}

.grid-item-container {
	position: relative;
	display: flex;
	justify-content: center;
	align-items: center;
	width: 100%;
	max-height: 100vh;
	align-self: center;

	--player-timeline-width: 90%;
}

.grid-item {
	width: 100%;
	height: 100%;
	max-height: 100vh;
	object-fit: contain;
}

/* Modal */
.modal-wrapper {
	position: fixed;
	top: 0;
	left: 0;
	z-index: 20;
	display: none;
	width: 100%;
	height: 100%;
	overflow-y: auto;
	background-color: rgb(0 0 0 / 40%);
}

.modal-open {
	display: flex;
}

.modal {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-height: 100%;
	margin: auto;
	background: var(--color3);
}

.modal-header {
	display: flex;
	padding: 0.1rem;
	background: var(--color2);
}

.modal-title {
	width: 100%;
	padding-left: 0.7rem;
	color: var(--color-text);
	font-size: 0.8rem;
	text-align: center;
}

.modal-close-btn {
	display: flex;
	margin: auto;
	background: var(--color3);
	border-radius: 0.1rem;
}

.modal-close-icon {
	height: 0.9rem;
	filter: var(--color-icons);
}

.modal-content {
	height: 100%;
	overflow-y: visible;
	background: var(--color3);
}

/* Modal select */
.modal-select {
	display: flex;
	flex-wrap: wrap;
}

.modal-select-option {
	padding: 0.1rem 0.2rem;
	color: var(--color-text);
	font-size: 0.8rem;
	border-width: 0.01rem;
	border-style: solid;
	border-color: var(--color1);
}

.modal-select-option-selected {
	background: var(--color1-hover);
}

/* form */
.form {
	overflow-y: auto;
}

.form-field {
	align-items: center;
	padding: 0.25rem;
	border-color: var(--color1);
	border-bottom-style: solid;
	border-bottom-width: 0.05rem;
}

.form-field-error {
	align-items: center;
	padding: 0.2rem;
	padding-bottom: 0.1rem;
	border-color: var(--color1);
	border-bottom-style: solid;
	border-bottom-width: 0.05rem;
}

.form-field-label {
	flex-grow: 1;
	float: left;
	width: 100%;
	min-width: 4rem;
	color: var(--color-text);
	font-size: 0.6rem;
}

.form-field-select {
	width: 100%;
	height: 1rem;
	font-size: 0.5rem;
}

.form-field-select-container {
	display: flex;
	width: 100%;
}

.form-field-select-custom-btn {
	flex-shrink: 0;
	width: 1rem;
	height: 1rem;
	margin-left: 0.5rem;
	padding: 0;
	border: 0;
	border-radius: 0.2rem;
}

.form-field-select-custom-btn:hover {
	background: black;
}

.form-field-edit-btn {
	display: flex;
	width: 1rem;
	height: 1rem;
	margin-left: 0.4rem;
	background: var(--color2);
	border-radius: 0.2rem;
}

.form-field-edit-btn:hover {
	background: var(--color2-hover);
}

.form-field-edit-btn-img {
	width: 0.8rem;
	height: 0.8rem;
	padding: 0.1rem;
	filter: var(--color-icons);
}

.form-button-wrapper {
	display: flex;
}

.form-button {
	margin: 0.2rem;
	padding: 0.1rem;
	border-radius: 0.2rem;
}

.form-button span {
	color: var(--color-text);
	font-size: 0.7rem;
}

/* buttons */
.save-btn {
	background: var(--color-green);
}

.save-btn:hover {
	background: var(--color-green-hover);
}

.delete-btn {
	margin-left: auto;
	background: var(--color-red);
}

.delete-btn:hover {
	background: var(--color-red-hover);
}

.checkbox {
	display: flex;
	justify-content: center;
	align-items: center;
	width: 0.8rem;
	height: 0.8rem;
	background: var(--color2);
	border-radius: 0.2rem;
}

.checkbox-checkbox {
	z-index: 1;
	width: 100%;
	height: 100%;
	outline: none;
	-moz-appearance: none;
	-webkit-appearance: none;
}

.checkbox-box {
	position: absolute;
	width: 0.65rem;
	height: 0.65rem;
	background: var(--color1);
	border-radius: 0.14rem;
}

.checkbox-check {
	position: absolute;
	width: 0.8rem;
	visibility: hidden;
	filter: invert();
}

.checkbox-checkbox:checked ~ .checkbox-box {
	background: var(--color2);
}

.checkbox-checkbox:checked ~ .checkbox-check {
	visibility: visible;
}

/* Logout */
#logout {
	display: flex;
	justify-content: center;
	align-items: center;
	width: var(--sidebar-width);
	margin-top: auto;
	margin-bottom: 0.4rem;
}

#logout button {
	margin-top: 0.1rem;
	padding-right: 0.1rem;
	padding-left: 0.1rem;
	color: var(--color-text);
	font-size: 0.6rem;
	background: var(--color2);
	border-width: 0.05rem;
	border-style: solid;
	border-color: var(--colorbg);
	border-radius: 0.2rem;
}

#logout button:hover {
	background: var(--color3);
}

/* Player */
.player-overlay-checkbox {
	position: absolute;
	opacity: 0;
}

.player-overlay-selector {
	position: absolute;
	z-index: 1;
	width: 100%;
	height: 100%;
	opacity: 0.5;
}

.player-overlay {
	position: absolute;
	z-index: 2;
	display: flex;
	justify-content: center;
	visibility: hidden;
	opacity: 0.1;
	transition: visibility 0.8s, opacity 0.7s;
	transition-timing-function: ease-in;
}

.player-overlay-top {
	position: absolute;
	top: 0;
	left: 0;
	display: flex;
	margin-right: auto;
}

.player-overlay-bottom {
	position: absolute;
	bottom: 4%;
	width: 100%;
	height: 0.6rem;
	min-height: 3.5%;
}

.player-top-bar {
	display: flex;
	flex-wrap: wrap;
	opacity: 0.8;
}

.player-menu-text {
	padding: 0.05em 0.4em 0.05em 0.2em;
	color: var(--color-text);
	font-size: 40%;
	background: var(--colorbg);
}

.player-overlay:hover {
	visibility: visible;
	opacity: 0.8;
}

.player-overlay-checkbox:checked ~ .player-overlay {
	visibility: visible;
	opacity: 0.8;
	transition: visibility 0s;
	transition: opacity 0s;
}

.player-overlay-checkbox:hover ~ .player-overlay {
	visibility: visible;
	opacity: 0.8;
	transition: visibility 0s, opacity 0.1s;
}

.player-play-btn {
	padding: 0.2rem;
	font-size: 0;
	background: var(--colorbg);
	border-radius: 50%;
	opacity: 0.8;
}

.player-play-btn img {
	aspect-ratio: 1;
	height: 0.8rem;
	filter: invert(90%);
}

.player-progress {
	box-sizing: border-box;
	width: 100%;
	width: var(--player-timeline-width);
	padding-top: 0.1rem;
	padding-bottom: 0.1rem;
	background: rgb(0 0 0 / 0%);
	opacity: 0.8;
	user-select: none;
}

.player-overlay:hover ~ .player-overlay {
	visibility: visible;
	opacity: 1;
}

.player-options-open-btn {
	position: absolute;
	right: 0.28rem;
	bottom: 0.8rem;
	width: 0.8rem;
	font-size: 0;
	background-color: rgb(0 0 0 / 0%);
	opacity: 0.5;
	transition: opacity 250ms;
}

.player-options-open-btn:hover {
	opacity: 0.8;
}

.player-options-open-btn-icon {
	width: 0.4rem;
	margin: auto;
	background: var(--colorbg);
	border-radius: 0.1rem;
}

.player-options-open-btn-img {
	width: 0.4rem;
	height: 0.8rem;
	filter: invert(90%);
}

.player-options-popup {
	position: absolute;
	right: 0.2rem;
	bottom: 1.75rem;
	display: none;
	grid-gap: 0.2rem;
	padding: 0.1rem;
	font-size: 0;
	background: var(--colorbg);
	border-radius: 0.15rem;
	opacity: 0.8;
}

.player-options-show {
	display: grid;
}

.player-options-btn {
	background-color: rgb(0 0 0 / 0%);
}

.player-options-btn img {
	aspect-ratio: 1;
	width: 0.8rem;
	filter: var(--color-icons);
}

.player-timeline {
	position: absolute;
	bottom: 0;
	width: var(--player-timeline-width);
	height: 0.6rem;
	fill: var(--color-red);
}

.player-detections {
	position: absolute;
	width: 100%;
	height: 100%;
	stroke: var(--color-red);
	fill-opacity: 0;
	stroke-width: 0.015rem;
}

.player-detection-text {
	fill-opacity: 1;
	fill: var(--color-red);
	stroke-opacity: 0;
}

/* Feed. */
.feed-btn {
	padding: 0.15rem;
	font-size: 0;
	background: rgb(0 0 0 / 0%);
	aspect-ratio: 1;
}

.feed-btn-img {
	height: 0.7rem;
}

.feed-btn::-moz-focus-inner {
	border: 0;
}

.feed-menu {
	bottom: 0;
	margin-bottom: 5%;
	background: var(--color1);
	border: none;
	border-radius: 0.2rem;
}

/* Mobile Landscape mode. */
@media (aspect-ratio >= 3/2) {
	:root {
		font-size: 12vh; /* Window scale. */

		--gridsize: 2;
	}

	#current-page {
		display: none;
	}

	#topbar {
		flex-direction: column;
		width: auto;
		height: 100%;
	}

	#options-btn {
		right: auto;
		bottom: 0;
	}

	#options-menu {
		right: auto;
		bottom: var(--topbar-height);
		left: 0;
	}

	.options-popup {
		top: calc(-1 * var(--topbar-height));
		right: auto;
		left: var(--topbar-height);
		width: auto;
	}

	.date-picker {
		height: 100vh;
	}

	#logout {
		display: none;
	}

	#statusbar {
		display: none;
	}

	#content {
		padding-top: 0;
		padding-left: var(--barsize);
	}
}

/* Tablet/Dektop. */
@media only screen and (width >= 768px) {
	:root {
		font-size: 4.5vh; /* Window scale. */

		--gridsize: 3;
	}

	#topbar {
		z-index: 6;
		flex-direction: row;
		width: var(--sidebar-width);
		height: auto;
		transition: width 400ms;
	}

	#topbar-options-btn {
		margin-left: auto;
	}

	#current-page {
		display: none;
	}

	#options-btn {
		right: auto;
		bottom: auto;
		left: calc(var(--sidebar-width) - var(--topbar-height));
		z-index: 7;
	}

	#options-menu {
		inset: auto auto auto var(--sidebar-width);
		transition: left 400ms;
	}

	.options-popup {
		top: 0;
		right: auto;
		left: var(--options-menu-btn-width);
		width: auto;
	}

	.date-picker {
		height: auto;
	}

	#sidebar {
		position: relative;
		width: 6rem;
		transform: none;
		transition: width 400ms;
	}

	#content {
		padding-top: 0;
		padding-left: var(--sidebar-width);
		transition: padding-left 400ms;
	}

	#sidebar-checkbox:checked ~ #options-menu {
		left: calc(var(--topbar-height) * 2);
	}

	#sidebar-checkbox:checked ~ #options-btn {
		left: var(--topbar-height);
	}

	#sidebar-checkbox:checked ~ #sidebar {
		width: 0;
	}

	#sidebar-checkbox:checked ~ #sidebar-btn {
		width: var(--topbar-height);
	}

	#sidebar-checkbox:checked ~ #content {
		padding-left: 0;
		transition: padding-left 400ms;
	}

	#sidebar-checkbox:checked ~ #topbar {
		width: 0;
		opacity: 0.5;
	}

	#sidebar-checkbox:checked ~ #sidebar-closer {
		width: 0;
	}

	.form {
		width: auto;
	}

	#nav-btn {
		margin-bottom: 0.6rem;
		visibility: hidden;
	}

	#statusbar {
		display: block;
	}

	#logout {
		display: flex;
	}

	.modal {
		width: 30vw;
		max-height: 90vh;
		padding-bottom: 0.3rem;
		border-radius: 0.2rem;
	}

	.modal-header {
		border-radius: 0.2rem 0.2rem 0 0;
	}
}
